import { post } from './ajax'
import { message } from 'ant-design-vue'

export const del = (tablename, id) => {
  return new Promise((resolve, reject) => {
    post('/api/common/delete', {
      table: tablename,
      id: id,
    })
      .then((res) => {
        if (res.data.status === 1) {
          message.success('修改成功')
          resolve()
        } else {
          message.error('网络繁忙,请稍后再试')
          reject(res.err)
        }
      })
      .catch((err) => {
        message.error('网络繁忙,请稍后再试')
        reject(err)
      })
  })
}
